fix(@angular/build): add bounded timeout to vitest executor disposal#33620
Open
clydin wants to merge 1 commit into
Open
fix(@angular/build): add bounded timeout to vitest executor disposal#33620clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a 10-second timeout when closing the Vitest instance during the disposal of VitestExecutor to prevent hanging processes. The review feedback correctly identifies a potential unhandled promise rejection issue: aborting the AbortController in the finally block will cause the setTimeout promise to reject after Promise.race has already settled. A code suggestion is provided to catch and suppress this AbortError safely.
When disposing the VitestExecutor in non-watch runs, `vitest.close()` can hang if a Vitest worker pool process or thread fails to terminate cleanly. Calling `process.exit()` in a builder runner is undesirable as it forcibly kills the host Node.js process and aborts any downstream Architect tasks or reporters. This change wraps `this.vitest.close()` in a `Promise.race` with an unref'd `setTimeout`. If `close()` stalls beyond 10 seconds, a warning is logged and disposal finishes cleanly, allowing host process execution and downstream logic to proceed. Fixes angular#32832
clydin
force-pushed
the
fix/vitest-close-timeout
branch
from
July 22, 2026 00:16
f0b9b35 to
ab65d8f
Compare
alan-agius4
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When disposing the VitestExecutor in non-watch runs,
vitest.close()can hang if a Vitest worker pool process or thread fails to terminate cleanly. Callingprocess.exit()in a builder runner is undesirable as it forcibly kills the host Node.js process and aborts any downstream Architect tasks or reporters.This change wraps
this.vitest.close()in aPromise.racewith an unref'dsetTimeout. Ifclose()stalls beyond 10 seconds, a warning is logged and disposal finishes cleanly, allowing host process execution and downstream logic to proceed.Fixes #32832